﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WXYW.DAL;
using WXYW.BLL;

namespace WXYW
{
    public partial class AddProductClass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void OKBtn_Click(object sender, EventArgs e)
        {
            try
            {
                ProductClass producClass = new ProductClass();
                producClass.Name = NameTxtBox.Text.Trim();
                producClass.Description = Description.Text.Trim();
                if (IsOEMTypeCheckBox.Checked)
                {
                    producClass.IsOEM = true;
                }
                else
                {
                    producClass.IsOEM = false;
                }

                ProductClassService classService = new ProductClassService();
                classService.AddProductClass(producClass);
                MsgLbl.Text = "添加成功！";

                NameTxtBox.Text = "";
                Description.Text = "";
                IsOEMTypeCheckBox.Checked = false;
            }
            catch (Exception ex)
            {
                MsgLbl.Text = string.Format("系统错误：{0}", ex.Message);
                LogUtility.LogUtilityIntance.LogException(ex, string.Format("AddProductClass -> OKBtn_Click:{0}", NameTxtBox.Text));
            }
        }
    }
}
